<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .box {
            width: 100px;
            height: 100px;
            position: absolute;
            left: 0;
            top: 0;
            background-color: gold;
            /*alternate 反向执行 会占用动画次数*/
            animation: move 4s ease 2 alternate;
        }

        @keyframes move {
            0% {
                left: 0;
                top: 0;
                width: 50px;
                height: 50px;
                background-color: gold;
            }

            25% {
                left: 400px;
                top: 0;
                width: 150px;
                height: 150px;
                background-color: red;
            }

            50% {
                left: 400px;
                top: 400px;
                width: 250px;
                height: 250px;
                background-color: blue;
            }

            75% {
                left: 0px;
                top: 400px;
                width: 50px;
                height: 50px;
                background-color: saddlebrown;
            }
            100% {

                left: 0;
                top: 0;
                width: 150px;
                height: 150px;
                background-color: olive;
            }
        }
    </style>
</head>

<body>

    <div class="box">


    </div>


</body>

</html>